<html>
<head>
	<title>Units Table Initialization</title>
</head>
<body>
	<?php
		/*This script creates the Units table and inserts data into it*/
		
		//Database login info
		include_once("../submit/pword.php");
		
		//Connect to the database
		mysql_connect("$server", "$username", "$password") or die(mysql_error());
		mysql_select_db("cs1630History") or die(mysql_error());
		
		//Drop the table if a current one exists
		$result = mysql_query("DROP TABLE IF EXISTS Units") or die(mysql_error());
		
		//Create the table
		$result = mysql_query(
					"CREATE TABLE Units (
						name char(35) primary key not null,
						category char(35) not null)") or die(mysql_error());
		
		//Insert the units (just add what units you need for now)
		$result = mysql_query(
					"INSERT INTO Units VALUES('people', 'not convertible')") 
					or die(mysql_error());
		$result = mysql_query(
					"INSERT INTO Units VALUES('acres', 'area')") 
					or die(mysql_error());
		$result = mysql_query(
					"INSERT INTO Units VALUES('square miles', 'area')") 
					or die(mysql_error());
		$result = mysql_query(
					"INSERT INTO Units VALUES('inches', 'length')") 
					or die(mysql_error());
		$result = mysql_query(
					"INSERT INTO Units VALUES('farenheit', 'temperature')") 
					or die(mysql_error());
		//Close
		mysql_close();
	?>
		
</body>
</html>